package com.sxhuayuan.parking.controller.parkinglot.user;

import com.sxhuayuan.parking.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sxhuayuan.parking.compenent.Page;
import com.sxhuayuan.parking.compenent.Pageable;
import com.sxhuayuan.parking.compenent.web.RespMessage;
import com.sxhuayuan.parking.entity.ParkChannel;
import com.sxhuayuan.parking.entity.ParkingLotUser;
import com.sxhuayuan.parking.service.ParkChannelService;
import com.sxhuayuan.parking.service.ParkingLotUserService;

/** 车场出口 */
@RestController("parkingLotUserParkingLotExitController")
@RequestMapping("/parkinglotuser/parkinglotexit")
public class ParkingLotExitController extends BaseController {

	@Autowired
	ParkChannelService service;
	@Autowired
	ParkingLotUserService parkingLotUserService;

	@RequestMapping("/list")
	public RespMessage list(@RequestBody Pageable pageable) {

		ParkingLotUser current = parkingLotUserService.getCurrent();

		if (current == null) {
			return invalidToken();
		}
		Page<ParkChannel> page = service.findPageByParkingLotUser(pageable, current);
		return successResp(page);
	}
}
